package com.yesjpt.dao;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import com.yesjpt.domain.City;

/**
 * 城市 DAO 接口类
 * <p>
 * Created by bysocket on 07/02/2017.
 */
public interface CityDao {
    @Delete("delete from sys_city where id = #{id}")
    Integer deleteById(@Param("id") String id);

    @Insert("insert into sys_city(id, name) values(#{id}, #{name})")
    Integer add(City vo);

    //更新
    int update(City vo);

    // 仅更新城市名称
    int updateName(City vo);

    List<City> listByParams(@Param("params") Map<String, Object> params);

    @Select("select * from sys_city where name like #{name}")
    List<City> findByName(@Param("name") String name);

    @Select("select * from sys_city where id = #{id}")
    City findById(@Param("id") String id);

    @Select("select * from sys_city t order by convert(t.name using gbk)")
    List<City> listAll();
}












